package com.share.strategicMode.task.enums;

import java.util.function.Predicate;

public enum  TimeType {
    hour(timeType-> timeType.equals("小时")),
    day(timeType-> timeType.equals("天")),
    week(timeType-> timeType.equals("周")),
    month(timeType-> timeType.equals("月")),
    year(timeType-> timeType.equals("年"));

    private final Predicate<String> support;

    TimeType(Predicate<String> timeType) {
        this.support = timeType;
    }
    public static TimeType typeof(String timeType){
        for (TimeType value : values()) {
            if(value.support.test(timeType.toString())){
                return value;
            }
        }
        return null;
    }
}
